home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / keyb / cedwars2.zip / PCED.ART < prev   
Text File  |  1987-11-15  |  12KB  |  302 lines

  1. Living with DOS:  PCED Command Editor
  2. by Barry Simon
  3.  
  4. Copyright (c) 1986, Capital PC User Group Inc.
  5. This material may be republished only for internal use
  6. by other not-for-profit user groups.
  7.  
  8. Additional material copyright (c) 1986, Barry Simon
  9.  
  10. Posted on Compuserve with permission of CPCUG.  May not be
  11. reproduced without including the above copyright notice.
  12.  
  13. Published in the February 1986 issue of the Capital PC Monitor.
  14.  
  15.  
  16. INTRODUCTION
  17.  
  18. This is the third article in a series on how to better cope
  19. with DOS by fully exploiting its capabilities and those of
  20. several software tools.  In this month's article, I discuss
  21. PCED, the commercial version of CED, the Command EDitor authored
  22. by Chris Dunford.  As you may recall from my review in the
  23. January Monitor, CED is a program which I find the most useful of
  24. all my utilities.  Both the public domain version of CED and PCED
  25. provide four basic services:
  26.  
  27.   o  A command line editor which is much closer to that provided
  28.      by a good word processor than the strange editing modes
  29.      provided by DOS.
  30.  
  31.   o  A command stack which allows you to recall and reissue, with
  32.      or without editing, DOS commands which you previously made.
  33.  
  34.   o  A parameter recall feature that allows you to execute a
  35.      program without having to reenter the required parameters.
  36.  
  37.   o  A macro facility called synonyms that allows you to issue
  38.      series of commands by issuing a shorthand name.
  39.  
  40. As indicated in my earlier review, both CED and PCED are loaded
  41. into memory where they permanently sit between the user and DOS.
  42.  
  43. While the original CED program remains in the public domain,
  44. numerous enhancements have been made and incorporated into the
  45. commercial version, PCED.  In fact, all of the facilities
  46. originally provided by CED have been improved upon and enhanced
  47. in the commercial version.
  48.  
  49. For the past few months, I have been using a beta test version of
  50. PCED and this article will discuss its features.  I must
  51. emphasize that what I am reviewing is a beta test version and not
  52. the final released product.
  53.  
  54.  
  55. FEATURES
  56.  
  57. Command Line Editor
  58.  
  59. A new feature has been added to the command line editor:  in CED,
  60. <Ctrl-End> erases to the end of the line; in PCED, <Ctrl-Home>,
  61. which erases from the start of the line to the cursor, is now
  62. available.  The only editing feature which I miss is a key to
  63. transpose two letters which would be useful for poor typists like
  64. me.
  65.  
  66. Because the DOS editing keys are not needed for DOS commands,
  67. they are disabled in CED.  However, this causes a problem when
  68. using EDLIN because the F3 key is used to partially retype a
  69. line.  In PCED, you get the F3 key back.  Of course, EDLIN is
  70. such a poor editor that you might view it as a virtue of CED that
  71. it makes it more difficult to use.
  72.  
  73.  
  74. Improved Stacking
  75.  
  76. The command stack has been improved in several ways.  Since you
  77. wouldn't want to have to run through a long list to find the
  78. command you want to reissue, it is important that the stack not
  79. be filled up with commands you don't need.  In PCED, the
  80. individual commands in a multiple command synonym are issued to
  81. DOS and appear on the screen, but only the original synonym is
  82. added to the stack.
  83.  
  84. The nicest new feature of the stack is "prestacking".  As in
  85. CED, hitting <Esc> blanks the command line but in PCED, hitting
  86. <Ctrl-K> blanks the command line and places it in the stack.
  87. That way, if you remember most of a long command but then realize
  88. you forgot the file name, you can prestack the command, call up a
  89. directory, and then recall the unfinished command.
  90.  
  91.  
  92. Better Synonym Processing
  93.  
  94. The first command in a multiple command synonym can itself be a
  95. synonym; in CED only the later ones can't be synonyms.  You can
  96. define several synonyms in a single line; with CED, I had two
  97. different synonyms, namely "gtbat" and "gtbatfiles" to mean
  98. "C:&cd\bin\batfiles".  Now putting "syn gtbat*file ..." in my
  99. CED configuration file defines five synonyms including the two
  100. that I used to have.  The letters after the "*" are optional when
  101. issuing the synonym.
  102.  
  103. With PCED, you can call up a synonym, say "foo", by typing "ced
  104. edit syn foo" on the command line, edit it and make the edited
  105. line the new meaning of foo by just pressing <Enter>.  I use this
  106. so often that I've made "edit" a synonym for "ced edit syn".
  107. PCED has a PACK command to remove redundant definitions from the
  108. synonym stack and a SAVE command to save all the current synonyms
  109. in a configuration file for loading with PCED in future sessions.
  110.  
  111. You can now issue internal commands to CED from a BATch file.  While
  112. you can't directly issue synonyms from a BATch file, a utility,
  113. XCED, is provided in the PCED package.  The XCED utility allows
  114. you to call synonyms from a BATch file by installing a temporary
  115. new shell of DOS.
  116.  
  117.  
  118. User Installed Commands
  119.  
  120. In CED, it is possible to install various user defined commands
  121. as part of CED which would act like DOS internal commands.
  122. Unless you have considerable programming experience, it is
  123. doubtful whether you would ever take advantage of this feature.
  124. To make this process easier, PCED includes several supplemental
  125. programs to install additional commands, including one that
  126. changes file attributes, one that allows you to call up SIDEKICK,
  127. and an enhanced directory command.
  128.  
  129.  
  130. Accessing the Environment
  131.  
  132. For me, the two most powerful new features of PCED allow you to
  133. access the environment and various predefined variables.  The
  134. environment is an area of memory set aside by DOS for storing
  135. information that it or other programs need.  You can place
  136. information into the environment with the SET command so that
  137. typing
  138.  
  139.   set a=abcd
  140.  
  141. at the DOS command line will add the variable a to the
  142. environment with a value of "abcd".  PCED lets you access such
  143. variables in synonyms by placing the variable within %-signs.
  144. Thus, if you have the string %a% inside a synonym and you execute
  145. the above command, the string would get replaced by the value
  146. abcd.  You would probably use this feature primarily with two of
  147. the three variables that DOS saves in the environment:  your
  148. prompt, and your path.  Here is a pair of synonyms which
  149. illustrate this feature:
  150.  
  151.   syn saveprmt set pr=%prompt%
  152.   syn recallprmt prompt=%pr%&set pr=
  153.  
  154. The first saves the current value of your prompt in a dummy
  155. environmental variable and the second recalls it.  Thus,
  156. since one program UTIL that I use tends to crash if it is loaded
  157. with my fancy prompt installed, I call it up with the synonym
  158.  
  159.   syn u saveprmt&prompt= &util&recallprmt
  160.  
  161.  
  162. Predefined Variables
  163.  
  164. Even more useful are several predefined variables whose default
  165. names are &m, &n, &p, and &c.  However, since I already use the &
  166. as my chain character in CED, I changed the & to # and I'll use
  167. that in my illustrations.  [Remember if you elect to follow my
  168. conventions, you must include the lines
  169.  
  170.   vc #
  171.   cc &
  172.  
  173. in your configuration file.  The first one changes the predefined
  174. variable character from & to #; the second one changes the chain
  175. character from # to &.]
  176.  
  177. Some of these predefined variables return the following:
  178.  
  179.   #m = the month in MM form
  180.   #d = the day in DD form
  181.   #n = the current drive without a :, e.g. A or B or C
  182.   #p = the current directory in the form C:\bin\batfiles
  183.   #c = the current directory in the form C:\bin\batfiles\
  184.  
  185. The difference between "#p\" and "#c" is that for the root
  186. directory, the first returns "\\" and the second only "\".
  187.  
  188. Here is a typical example of how to use these variables.  I
  189. download my electronic mail with a BATch file that, in
  190. particular, puts it into a file called temp.imp.  I like to keep
  191. the mail on disk in a file with the date of receipt.  Thus I
  192. include the line
  193.  
  194.   xced ren temp.imp mail#m#d
  195.  
  196. The xced is there to allow me to invoke ced from the BATch file.
  197. Mail that I capture on December 25, winds up in a file called
  198. mail1225.
  199.  
  200.  
  201. Examples of Synonyms Using #n, #p and #c
  202.  
  203. While all predefined variables are useful, #n, #p and #c are
  204. especially so since the replacements take place before any
  205. com